package com.sunny.ihealth.entity.bmob;

import java.util.List;

import cn.bmob.v3.BmobObject;
import cn.bmob.v3.datatype.BmobFile;

/**
 * 帖子信息
 * Created by Sunny  An on 2016/5/25.
 */
public class Post extends BmobObject {
    private UserInfo author;
    private String content;
    private List<BmobFile> pictures;
    private Integer likeNumber;
    private Integer commentNumber;
    private Boolean isLiked;
    private Integer id;

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public UserInfo getAuthor() {
        return author;
    }

    public void setAuthor(UserInfo author) {
        this.author = author;
    }

    public String getContent() {
        return content;
    }

    public void setContent(String content) {
        this.content = content;
    }

    public List<BmobFile> getPictures() {
        return pictures;
    }

    public void setPictures(List<BmobFile> pictures) {
        this.pictures = pictures;
    }

    public Integer getLikeNumber() {
        return likeNumber;
    }

    public void setLikeNumber(Integer likeNumber) {
        this.likeNumber = likeNumber;
    }

    public Integer getCommentNumber() {
        return commentNumber;
    }

    public void setCommentNumber(Integer commentNumber) {
        this.commentNumber = commentNumber;
    }


    public Boolean getLiked() {
        return isLiked;
    }

    public void setLiked(Boolean liked) {
        isLiked = liked;
    }


    /**
     * 是否喜欢过该帖子
     *
     * @return
     */
    public boolean isLiked() {
        return isLiked != null && isLiked;
    }


    public String[] getListPictures() {
        String[] picUrls = null;
        if (pictures != null && pictures.size() != 0) {
            picUrls = new String[pictures.size()];
            for (int i = 0; i < pictures.size(); i++) {
                picUrls[i] = pictures.get(i).getUrl();
            }
        }
        return picUrls;
    }

}
